{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": true
   },
   "source": [
    "# PR曲线"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "import numpy as np\n",
    "import matplotlib.pyplot as plt\n",
    "from sklearn import datasets"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "digits = datasets.load_digits()\n",
    "X = digits.data\n",
    "y = digits.target.copy()\n",
    "\n",
    "# 把数据变为极度偏斜的数据\n",
    "# 把手写数字分为9和非9两大类， 重点关注的是分类为9的数字\n",
    "y[digits.target==9] = 1\n",
    "y[digits.target!=9] = 0"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [],
   "source": [
    "from sklearn.model_selection._split import train_test_split\n",
    "X_train, X_test, y_train, y_test = train_test_split(X, y, random_state=666)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [],
   "source": [
    "from sklearn.linear_model.logistic import LogisticRegression\n",
    "\n",
    "log_reg = LogisticRegression()\n",
    "log_reg.fit(X_train, y_train)\n",
    "y_predict = log_reg.predict(X_test)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [],
   "source": [
    "decision_scores = log_reg.decision_function(X_test)\n",
    "thresholds = np.arange(np.min(decision_scores), np.max(decision_scores), 0.1)\n",
    "# thresholds中每一个值都是一个阈值，然后绘制那个阈值下，对应的精准率，召回率"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 绘制每个threshold值下，对应的精准率，召回率"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [],
   "source": [
    "from sklearn.metrics.scorer import precision_score, recall_score\n",
    "precisions = []\n",
    "recalls = []\n",
    "\n",
    "for threshold in thresholds:\n",
    "    y_predict = np.array(decision_scores >= threshold, dtype=int)\n",
    "    precisions.append(precision_score(y_test, y_predict))\n",
    "    recalls.append(recall_score(y_test, y_predict))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXcAAAD8CAYAAACMwORRAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDIuMS4xLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvAOZPmwAAIABJREFUeJzt3XmcXFWd9/HPr7au3jtJd/Y9JIGwQxP2RUANoxKXkQEFN0aEGXzho88oDDO+1PGZUZnRRx0cn6gooIAogoziIJuKSBICIZAQyEqWztZZutNrdS3n+eNWh04nnd5u9e2q+r5fr35V1a2bur9LhW9On3vuOeacQ0RECkso6AJERMR/CncRkQKkcBcRKUAKdxGRAqRwFxEpQAp3EZECpHAXESlACncRkQKkcBcRKUCRoA5cW1vrZs6cGdThRUTy0osvvrjXOVfX336BhfvMmTNZsWJFUIcXEclLZrZlIPupW0ZEpAAp3EVECpDCXUSkACncRUQKkMJdRKQA9RvuZnaXme0xs9V9vG9m9h0z22Bmr5jZGf6XKSIigzGQlvtPgEXHeP8KYG725wbgv4ZfloiIDEe/49ydc38ys5nH2GUxcI/z1utbamY1ZjbJObfTpxoPt+V52Ph0Tj5aJK+VVMDZN0EkFnQlgVq3u4XfrNoRdBnHdNkJEzh1Wk1Oj+HHTUxTgG09Xm/Pbjsi3M3sBrzWPdOnTx/a0bYvhz/dMbQ/K1KwsmshTz4DZl0YbCkBW/KnTfzyxe2YBV1J38ZXxfMi3AfMObcEWAJQX18/tJW5z7/F+xGRt+x6Fb5/AXQcCLqSwHUk08ypK+epz10SdCmB8mO0TAMwrcfrqdltIjJS4tXeY2dzsHWMAolkhpJIOOgyAudHuD8KfCQ7auYcoDln/e0icnTx7K/4HfshnQI3tF+MC0EilaYkqlHeA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+v6EwSu2bpkdwMXZ55cC67PPHwU+kh1lcQ7Q3OPXpXz0CN5FVcxsHt4Fqr1453m1mZWY2SxgLrA8sCqHwTn3qnNuvHNupnNuJt6v8Wc453ZRQN+nmS3Cu6ZwpXOuvcdbBfNdZg1k3Yi8lF1P+kfAWufcN3u81XMdjI8Cv/bzuAXXcu/HJ4FvZ1eL6gRuyG5/DG+ExQagHfh4MOX55i7gLjNbDXQBH822+NaY2YPAa3i/4v+9cy4dYJ25Ukjf53/ijYh5IvsbylLn3I3OW1OhYL5L18e6EQGX5ZfzgeuAV83s5ey2fwS+htdlej3eaK+r/Dyo7lAVESlAxdYtIyJSFBTuIiIFSOEuIlKAFO4iIgVI4S4iUoAU7iIiBUjhLiJSgBTuIiIF6P8DtISc9jq8sY0AAAAASUVORK5CYII=\n",
      "text/plain": [
       "<matplotlib.figure.Figure at 0x10928ec18>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "plt.plot(thresholds, precisions)\n",
    "plt.plot(thresholds, recalls)\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Precision-Recall 曲线"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAYUAAAEKCAYAAAD9xUlFAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDIuMS4xLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvAOZPmwAAF+9JREFUeJzt3X2UHXWd5/H3tzsJIZDnBAlJmqAEhwAq2LIgM4IjKjBngs6sSgZ3RF2YMysOK65ndPXgw+g547CyRxzYkVVHcHwAnRlPVsKyyOLoIjgJymMQjUwCeZCEPJJOOp1Of/ePeymbJt19E7tudd9+v87pw62qX9f9pui+n/7Vr+pXkZlIkgTQV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DfO8j29wGZmadRm+zt5oiYXN/2KuAdwGnAOyJiIVKTGAoar46MiAepfdA/BXy5vn5dfY56qE3MtwS4t972XcDxwMuBTZm5EiAzd2Vm74D93wtcFxF/Acw4yPbfBf6h/v0/B9ZRm98I4O76fFDdwOr6e0pN4dxHGq/21v+KL9Tnn+rqvwq4KzOXDWh32nA7z8y/jojbqc1Rc29EvJnGHx7Uf7bcA/h7qiaypyAN7n7gnIg4ESAijoqIk4AngHkR8Zr6+qn101CFiHhZZj6SmZ+lNgvo7wzY94+AS+ttTwI66vuVKmUoSIPIzC3UHvzzzYh4GLgP+J36IyPfAXwhIh4C7qI2lXN//7l+uevDwH5e/FS9G4G2iHiE2vjEZS38PA2NIV6SKkkq2FOQJBUMBUlSwVCQJBUMBUlSwVCQJBUMBUlSwVCQJBUMBUlS4f8D9FXuUJi+ZTcAAAAASUVORK5CYII=\n",
      "text/plain": [
       "<matplotlib.figure.Figure at 0x109331f98>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "plt.plot(precisions, recalls)\n",
    "plt.xlabel('Precision')\n",
    "plt.ylabel('Recall')\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### sklearn中的Precision-Recall曲线"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [],
   "source": [
    "from sklearn.metrics.ranking import precision_recall_curve\n",
    "\n",
    "precisions, recalls, thresholds =precision_recall_curve(y_test, decision_scores)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(145,)"
      ]
     },
     "execution_count": 11,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# scikit-learn会自动取它认为适合的步长\n",
    "precisions.shape"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(145,)"
      ]
     },
     "execution_count": 12,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# scikit-learn会自动取它认为适合的步长\n",
    "recalls.shape"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(144,)"
      ]
     },
     "execution_count": 13,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 注意thresholds会比precisions和recalls少一条记录（最后那条记录）\n",
    "thresholds.shape"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXcAAAD8CAYAAACMwORRAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDIuMS4xLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvAOZPmwAAIABJREFUeJzt3Xl8VOXd/vHPNwtJIAuEhICQsAYBEVkiYt0REbSKVdx3UaStXaztU7toW6vPU7W2P221FRUUtbVqraBSQNxwYUdACLLv+x4CZL9/f5xBYwhkIDM5M5Pr/XrNa7aTzMU4XtycOee+zTmHiIjElji/A4iISOip3EVEYpDKXUQkBqncRURikMpdRCQGqdxFRGKQyl1EJAap3EVEYpDKXUQkBiX49cJZWVmuQ4cOfr28iEhUmjt37g7nXHZd2/lW7h06dGDOnDl+vbyISFQys7XBbKfdMiIiMUjlLiISg1TuIiIxSOUuIhKDVO4iIjGoznI3szFmts3MFh3heTOzJ8xshZktNLO+oY8pIiLHIpiR+/PAkKM8PxTID1xGAn+rfywREamPOo9zd85NM7MOR9lkGDDOeev1zTCz5mbWxjm3OUQZv2ntdFj5Ppz9M0hoEpaXEIlEs9fs4uNl2/2OISFwfvccTsltHtbXCMVJTG2B9dXubwg8dli5m9lIvNE9eXl5x/dq62fCtEfgzB8DKndpPB6dtJRZa3Zh5ncSqa9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sM3vQDU557Yeuh0pn0czS8Qr9pedc28EHg7rexlzI/fjYWbZh76cNLNOQD6wyt9Uh5kAXGNmSWbWES/jLJ8zARD4YB7yHbwvhSNBMGsR+MrMmplZ2qHbwGAi5/2rTfW1G24GxvuYpVaR9nk0M8ObFn2Jc+5P1Z4K73vpnGs0F7z/0BvwRulbgcmBx68AFgPzgXnAJZGWMfDcr4CVwFJgqN/vZ7VcLwJfAAsDH9g2fmeqlu0iYFngffuV33lqydcJWBC4LI6kjMA/8XZrlAc+kyPw1kZ+D1gOTAUyIzBjRH0egTPxdrksDHTM/MDnMqzvpc5QFRGJQdotIyISg1TuIiIxSOUuIhKDVO4iIjFI5S4iEoNU7iIiMUjlLiISg1TuIiIx6P8DwaYL2YNYbTcAAAAASUVORK5CYII=\n",
      "text/plain": [
       "<matplotlib.figure.Figure at 0x1099aa1d0>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "# scikit-learn中没有从最小的threshold值开始取，它会从它认为合适的位置开始\n",
    "plt.plot(thresholds, precisions[:-1])\n",
    "plt.plot(thresholds, recalls[:-1])\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAYUAAAEKCAYAAAD9xUlFAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDIuMS4xLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvAOZPmwAAGdlJREFUeJzt3X2UXXV97/H3J5PnkOcMIWTyBCRIBKI4gkqrVMFGvAYVRVi0lVuU6gWlPtwrLS5qqb0VveIqNnqbAgpUQaTtNWKQokB5kGhCCQFCAyEBMklIZpKQZCZMJpn53j/OzvY4JDNnMrPPPufM57VWlvvs/ZtzPnMc5jN7//bZWxGBmZkZwJC8A5iZWeVwKZiZW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sOYDqYyAAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<matplotlib.figure.Figure at 0x109c46b00>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "# PR曲线\n",
    "plt.plot(precisions, recalls)\n",
    "plt.xlabel('Precision')\n",
    "plt.ylabel('Recall')\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 2",
   "language": "python",
   "name": "python2"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 2
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython2",
   "version": "2.7.6"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 0
}
